package com.aiks.single.singlemavenproject.aware;

import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author <a href="mailto:yuanz@yxt.com">yuanz</a>
 * @date 2021-09-01 10:40
 * @since 1.0.0
 **/
@Component
public class EnvironmentHelper implements EnvironmentAware {
    
    private static Environment environment;

    @Override
    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }

    /**
     * 获取属性值.
     *
     * @param property
     * @return
     */
    public static String get(String property) {
        return environment.getProperty(property);
    }
}
